package com.study.springbootsecurity.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 系统角色实体类
 * 对应数据库表：sys_role
 */
@Data
@Accessors(chain = true)
@TableName("sys_role")
@Schema(name = "Role", description = "系统角色实体")
public class Role implements Serializable {

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "角色ID", example = "1")
    private Long id;

    @Schema(description = "租户ID", example = "1001")
    private Long tenantId;

    @Schema(description = "父角色ID", example = "0")
    private Integer parentId;

    @Schema(description = "角色名称", example = "管理员")
    private String roleName;

    @Schema(description = "角色编码", example = "ROLE_ADMIN")
    private String roleCode;

    @Schema(description = "角色描述", example = "系统管理员，拥有所有权限")
    private String roleDesc;

    @Schema(description = "排序号", example = "1")
    private Integer sort;

    @TableField(exist = false)
    private List<String> permissions;

    @TableLogic(delval = "1",value = "0")
    @Schema(description = "删除标志（0：未删除，1：已删除）", example = "0")
    private Integer isDelete;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间", example = "2023-01-01 12:00:00")
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间", example = "2023-01-01 12:00:00")
    private Date updateTime;
}
